package com.niodata.dp.core.usermgr.dao;

import com.niodata.dp.core.usermgr.model.UserKeytab;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * Created by ndp on 17-3-13.
 */
@Mapper
public interface UserKeytabMapper {

  void insert(@Param("userKeytab") UserKeytab userKeytab);

  int delete(@Param("userName") String userName);

  int update(@Param("userName") String userName, @Param("keytab") byte[] keytab);

  @Select("select HDFS_USER_NAME as userName,KEYTAB as keytab,"
        + "CREATE_TIME as createTime from USER_KEYTAB"
        + " where HDFS_USER_NAME=#{userName}")
  UserKeytab select(@Param("userName") String userName);
}
